/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#ifndef M_DATASTREAM_H
#define M_DATASTREAM_H

namespace Engine
{
	/**
	*   Abstract class define interface for reading files.
	*/
	class DataStream
	{
	public:

		/**
		*   Destructor.
		*/
		virtual ~DataStream(){}

		/**
		*   Read the requisite number of bytes from the stream, stopping at the end of the file.
		*   @param buf Reference to a buffer pointer
		*   @param count Number of bytes to read
		*   @returns The number of bytes read
		*/
		virtual unsigned int Read(void* buf, unsigned int count) = 0;

		/**
		*   Repositions the read point to a specified byte.
		*/
		virtual void Seek( unsigned int pos ) = 0;

		/**
		*   Returns the current byte offset from beginning.
		*/
		virtual unsigned int Tell(void) const = 0;

		/**
		*   Returns true if the stream has reached the end.
		*/
		virtual bool Eof(void) const = 0;

		/**
		*   Close the stream, this makes further operations invalid.
		*/
		virtual void Close(void) = 0;

		/**
		*   Return stream size in bytes.
		*/
		virtual unsigned int GetSize() = 0;
	};
}

#endif

